package com.qianli.cashmama.product.server.mapper;

import com.qianli.cashmama.product.server.entity.AppProductCategoryEntity;
import com.qianli.cashmama.product.server.entity.CategoryAuthEntity;
import com.qianli.cashmama.product.server.entity.ProductCategoryEntity;
import com.qianli.cashmama.product.server.entity.UserAuthEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * Created by xuyang on 2017/7/19.
 */
public interface ProductCategoryMapper {
    /**
     * where code = #{code}
     * @param code
     * @return
     */
    ProductCategoryEntity getByCode(@Param("code") String code);

    /**
     * where code in (...) and deleted = 0
     * @param codes
     * @return
     */
    List<ProductCategoryEntity> getByCodes(@Param("codes") Set<String> codes);

    /**
     * where app_code = ${appCode} and deleted = 0
     * @param appCode
     * @return
     */
    List<AppProductCategoryEntity> getProductCategoryByAppCode(@Param("appCode") String appCode);

    /**
     * 根据appCode获取category
     * @param appCode
     * @return
     */
    List<ProductCategoryEntity> getCategoryByAppCode(@Param("appCode") String appCode);

    /**
     * 获取所有userAuth信息
     */
    List<UserAuthEntity> getAllUserAuth();

    /**
     * 获取所有数据 不分页
     * @return
     */
    List<AppProductCategoryEntity> getAllApplicationCategoryForCache();

    /**
     * 获取所有 产品类目
     * @return
     */
    List<ProductCategoryEntity> getAllProductCategoryForCache();

    /**
     * 获取所有可用的产品类目
     * @return
     */
    List<ProductCategoryEntity> getAllActiveProductCategory();

    ProductCategoryEntity getCategoryByCode(String code);

    List<ProductCategoryEntity> getProductCategoriesByMerchantCode(@Param("merchantCode") String merchantCode);

    void updateByEntity(ProductCategoryEntity entity);

    void insertNewOne(ProductCategoryEntity entity);
}
